package com.gitee.wsl.ext.number

import kotlin.math.abs

fun Double.isAlmostZero(): Boolean = kotlin.math.abs(this) <= 1e-19
fun Float.isAlmostZero(): Boolean = kotlin.math.abs(this) <= 1e-6

fun almostEquals(a: Float, b: Float) = almostZero(a - b)
fun almostZero(a: Float) = abs(a) <= 0.0000001

fun almostEquals(a: Double, b: Double) = almostZero(a - b)
fun almostZero(a: Double) = abs(a) <= 0.0000001
